// 专门原来操作cookie的方法包
// 内部封装了繁琐的操作方法 参数处理 暴露三个函数 get set remove

import { TOKEN_KEY } from "@/constants"
import Cookies from "js-cookie"


// 获取token的方法
export const getLocalToken = () =>{
  return Cookies.get(TOKEN_KEY)
}

// 设置token
export const setLocalToken = (token:string) =>{
  Cookies.set(TOKEN_KEY,token)
}

// 删除token

export const removeLocalToken = () =>{
  Cookies.remove(TOKEN_KEY)
}



//账号 
 const UserName :string = 'User'

// 密码

const PasswordName :string = 'Password'

// 存储账号密码

export const setUser = (User:string) => {
  Cookies.set(UserName, User);
}

export const setPassword = (password: string) => {
  Cookies.set(PasswordName, password);
}

// 清空账号密码

export const claearUser = () =>{
    Cookies.remove(UserName)
}
export const claearPassword = () =>{
    Cookies.remove(PasswordName)
}

// 获取账号密码
export const getUser = () =>{
  const res =  Cookies.get(UserName)
  
  return res
}

export const getPassword = () =>{
 const res = Cookies.get(PasswordName)
 return res
}